using Universal.Application.Contracts.Common;
using Universal.Application.Contracts.Dto.ArticleCategory;

namespace Universal.Application.Repositories;

/// <summary>
/// 文章分类服务
/// </summary>
public interface IArticleCategoryService
{
    /// <summary>
    /// 创建文章分类
    /// </summary>
    Task<ApiResponse<ArticleCategoryDto>> CreateAsync(CreateArticleCategoryDto dto);
    
    /// <summary>
    /// 更新文章分类
    /// </summary>
    Task<ApiResponse<ArticleCategoryDto>> UpdateAsync(UpdateArticleCategoryDto dto);
    
    /// <summary>
    /// 删除文章分类
    /// </summary>
    Task<ApiResponse<bool>> DeleteAsync(Guid id);
    
    /// <summary>
    /// 根据ID获取文章分类
    /// </summary>
    Task<ApiResponse<ArticleCategoryDto>> GetByIdAsync(Guid id);
    
    /// <summary>
    /// 获取所有文章分类（树形结构）
    /// </summary>
    /// <param name="activeOnly">是否只返回激活状态的分类，默认为true</param>
    Task<ApiResponse<List<ArticleCategoryDto>>> GetTreeAsync(bool activeOnly = true);
    
    /// <summary>
    /// 分页查询文章分类
    /// </summary>
    Task<ApiResponse<PagedResult<ArticleCategoryDto>>> GetPagedAsync(ArticleCategoryQueryDto query);
    
    /// <summary>
    /// 获取子分类列表
    /// </summary>
    Task<ApiResponse<List<ArticleCategoryDto>>> GetChildrenAsync(Guid? parentId);
    
    /// <summary>
    /// 切换激活状态
    /// </summary>
    Task<ApiResponse<bool>> ToggleActiveAsync(Guid id);
    
    /// <summary>
    /// 检查分类名称是否唯一
    /// </summary>
    Task<ApiResponse<bool>> IsNameUniqueAsync(string name, Guid? parentId, Guid? excludeId = null);

    /// <summary>
    /// 分配子分类
    /// </summary>
    Task<dynamic> AssignChildrenAsync(AssignChildrenDto assignChildrenDto);
    
    /// <summary>
    /// 移除子分类
    /// </summary>
    Task<dynamic> RemoveChildrenAsync(AssignChildrenDto assignChildrenDto);
    
    /// <summary>
    /// 分配文章到分类
    /// </summary>
    Task<dynamic> AssignArticlesAsync(AssignArticlesDto assignArticlesDto);
    
    /// <summary>
    /// 从分类移除文章
    /// </summary>
    Task<dynamic> RemoveArticlesAsync(AssignArticlesDto assignArticlesDto);
}